package com.itwhy.gift.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.itwhy.gift.domain.Employee;
import com.itwhy.gift.mapper.EmployeeMapper;
import com.itwhy.gift.query.EmployeeQuery;
import com.itwhy.gift.service.IEmployeeService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.itwhy.gift.util.PageList;
import com.itwhy.gift.vo.EmployeeVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author XHU_WHY
 * @since 2024-05-28
 */
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements IEmployeeService {
    @Resource
    private EmployeeMapper employeeMapper;
    @Override
    public PageList<EmployeeVO> selectByQuery(EmployeeQuery query) {
        Page<EmployeeVO> page = new Page<>(query.getPage(),query.getRows());
        List<EmployeeVO> list = employeeMapper.selectByQuery(page,query);
        return new PageList<>(page.getTotal(), list);
    }
}
